package com.dwxt.cdms.service;

import com.dwxt.cdms.dao.oufu.OuFuLocDataMapper;
import com.dwxt.cdms.entity.oufu.OuFuLocData;
import com.dwxt.cdms.entity.oufu.OuFuLocDataExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @description: TODO
 * @className: OuFu2Service
 * @author: yanlong
 * @createDate: 2021/05/13 16:13
 * @version: v1.0
 */
@Service
public class OuFu2Service {

    @Autowired
    private OuFuLocDataMapper ouFuLocDataMapper;

    public OuFuLocData selectLastLocDataByType(Integer customerId, String type) {
        OuFuLocDataExample example = new OuFuLocDataExample();
        example.setOrderByClause("create_time desc");
        example.createCriteria().andCustomerIdEqualTo(customerId).andTypeEqualTo(type);
        List<OuFuLocData> ouFuDataList = ouFuLocDataMapper.selectByExample(example);
        return ouFuDataList.size() > 0 ? ouFuDataList.get(0) : null;
    }

    public Map selectLastLocDataByCustomerId(Integer customerId) {
        return ouFuLocDataMapper.selectLastLocDataByCustomerId(customerId);
    }
}
